package net.xinqushi.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component(value="log") 
public class Log {
	public void myPoint(){}
	public void mybefore(JoinPoint jp)  //获得连接点信息
	{
		System.out.println(jp.getSignature());
		System.out.println("方法执行开始....");
	}
	public void myend(JoinPoint jp)
	{
		System.out.println("方法执行结束....");
	}
}


/*@Aspect
@Component(value="log") 
//初始化对象
public class Log {
	//前置通知
	@Pointcut("execution(* net.xinqushi.service.impl.*.*(..))")
	public void myPoint(){}
	@Before("myPoint()")
	public void mybefore(JoinPoint jp)  //获得连接点信息
	{
		System.out.println(jp.getSignature());
		System.out.println("方法执行开始....");
	}
	//后置通知
	@AfterReturning("myPoint()")
	public void myend(JoinPoint jp)
	{
		System.out.println("方法执行结束....");
	}
}
*/